﻿#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <string.h>
#include <math.h>
#include <unordered_map>
using namespace std;

class Solution {
public:
    bool searchMatrix(vector<vector<int>>& matrix, int target) {
        int n = matrix.size(), m = matrix[0].size(), x = 0, y = m - 1;
        while (x < n && y >= 0)
        {
            if (matrix[x][y] == target) return true;
            else if (matrix[x][y] > target) y -= 1;
            else x += 1;
        }
        return false;
    }
};

int main()
{
    return 0;
}